package com.changgou.goods.dao;

import com.changgou.goods.pojo.Spec;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface SpecMapper extends Mapper<Spec> {
    /**
     * 根据商品分类名称查询品牌信息
     * @param categoryName
     * @return
     */
    @Select(value = "SELECT \n" +
            "     DISTINCT\n" +
            "     s.name,s.options\n" +
            "FROM tb_category c,\n" +
            "     tb_spec s\n" +
            "WHERE c.`template_id` = s.template_id\n" +
            "AND c.name = #{categoryName}")
    public List<Map> findSpecListByCategoryName(@Param("categoryName") String categoryName);
}
